package br.com.dojo.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import br.com.dojo.dao.ClienteDAO;
import br.com.dojo.entity.Cliente;

@Service
@Transactional
public class ClienteService {
	@Autowired
	ClienteDAO dao;

	public List<Cliente> listarClientes() {

		List<br.com.dojo.entity.Cliente> clientes = dao.findAll();

		List<Cliente> result = new ArrayList<Cliente>();
		for (br.com.dojo.entity.Cliente cliente : clientes) {
			Cliente c = new Cliente();
			c.setNome(cliente.getNome());
			result.add(c);
		}

		return result;
	}

}
